<template>
  <view class="app column">
    <view class="option-wrap">
      <view class="cell row b-b" @click="navTo('/pages/auth/payPassword')">
        <text class="tit">更换手机号</text>
        <text class="tip">17521033321</text>
        <text class="mix-icon icon-you"></text>
      </view>
      <view class="cell row b-b" @click="showPopup('mixModal')">
        <text class="tit">用户注销</text>
        <text class="mix-icon icon-you"></text>
      </view>
      <view
        class="cell row b-b"
        @click="navTo('/pages/public/web-view?url=' + $config.agreement0)"
      >
        <text class="tit">用户协议</text>
        <text class="mix-icon icon-you"></text>
      </view>
      <view
        class="cell row b-b"
        @click="navTo('/pages/public/web-view?url=' + $config.agreement1)"
      >
        <text class="tit">隐私政策</text>
        <text class="mix-icon icon-you"></text>
      </view>
      <!-- #ifdef APP-PLUS -->
      <view class="cell row b-b" @click="checkVersion">
        <text class="tit">检查更新</text>
        <view class="row" @click.stop.prevent="stopPrevent">
          <version-update ref="versionUpdate"></version-update>
        </view>
        <text class="mix-icon icon-you"></text>
      </view>
      <!-- #endif -->
    </view>

    <mix-button
      ref="confirmBtn"
      text="退出登录"
      :isConfirm="false"
      marginTop="160rpx"
      @onConfirm="showPopup('cfmModal')"
    ></mix-button>

    <logout-modal ref="mixModal" @onConfirm="logout"></logout-modal>
    <user-confirm
      ref="cfmModal"
      title="温馨提示"
      text="确认退出登录吗?"
      @onConfirm="logout"
    ></user-confirm>
  </view>
</template>

<script>
import userConfirm from "../../components/user-confirm/user-confirm.vue";
import logoutModal from "./components/logout-modal.vue";
export default {
  components: {
    logoutModal,
    userConfirm,
  },
  data() {
    return {};
  },
  methods: {
    async logout() {
      this.$refs.confirmBtn.loading = true;
      // const res = await this.$request('user', 'logout');
      //   const res = await this.$http.get(LOGOUT, {});
      // if (res.Code == 200) {
      this.$refs.confirmBtn.loading = false;
      this.$util.msg("您已退出登录");
      this.$store.commit("logout");
      setTimeout(() => {
        uni.navigateBack();
      }, 1000);
      // }
    },
    //检查更新
    checkVersion() {
      this.$refs.versionUpdate.checkVersion();
    },
  },
};
</script>

<style>
page {
  background: #f7f8f9;
}
</style>
<style scoped lang="scss">
.app {
  background: #f7f8f9;
}
.option-wrap {
  margin-top: 20rpx;
  padding: 10rpx 44rpx 0;
  background: #fff;
}
.cell {
  height: 106rpx;

  .tit {
    flex: 1;
    font-size: 30rpx;
    color: #333;
  }
  .tip {
    margin-right: 10rpx;
    font-size: 26rpx;
    color: #999;
  }
  .icon-you {
    font-size: 24rpx;
    color: #aaa;
  }
  .icon-xuanzhong {
    font-size: 36rpx;
    color: #d8d8d8;

    &.active {
      color: $base-color;
    }
  }
  switch {
    transform: scale(0.8) translateX(10rpx);
    transform-origin: center right;
  }
  .loading {
    transform: translateX(8rpx);
  }
}
</style>
